package fctuc.dei.myTwitter.client;

public class RunClient {

	MyTwitterClient cl;
	
	public static void main(String[] args){
		if (args.length < 2){
			System.out.println("missing argument > client <tcp|nio> <prod|test>");
			return;
		}
		
		if (!args[0].equalsIgnoreCase("tcp") && !args[0].equalsIgnoreCase("nio") && !args[0].equalsIgnoreCase("rmi")){
			System.out.println("missing argument > client <tcp|nio|rmo>");
			return;
		}
		if(!args[1].equalsIgnoreCase("prod") && !args[1].equalsIgnoreCase("test")){
			System.out.println("missing argument > client <tcp|nio> <prod|test>");
			return;
		}
		
		boolean benchmark;
		if(args[1].equalsIgnoreCase("prod"))
			benchmark = false;
		else
			benchmark = true;
		
		System.out.println("vou correr um cliente do tipo > " + args[0]);
		MyTwitterClient cl = new MyTwitterClient(args[0], benchmark);
		cl.addListener(new TwitterClientListener() {
			
			@Override
			public void sessionTerminated() {
				System.exit(0);
			}
		});
		cl.run();
	}
}
